package fr.excilys.gwt.uibinder.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiConstructor;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;

public class FormInput extends Composite {

	private static FormInputUiBinder uiBinder = GWT
			.create(FormInputUiBinder.class);

	interface FormInputUiBinder extends UiBinder<Widget, FormInput> {
	}

	@UiField
	Label label;

	@UiField
	TextBox input;

	@UiConstructor
	public FormInput(String label) {
		initWidget(uiBinder.createAndBindUi(this));
		this.label.setText(label);
	}

	public String getInput() {
		return this.input.getText();
	}

	public void clearInput() {
		this.input.setText("");
	}
}
